<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://chances.com.cn/jsp/epgdata" prefix="epgdata"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://chances.com.cn/jsp/epgutils" prefix="epgutils" %>

<!-- 菜单栏目-->
<epgdata:categoryItem var="menu_cat" size="4" code="${_templateParams['menu_cat']}" />
<!-- 历史与搜索 --> 
<epgdata:categoryItem var="historySearch_cat" size="2" code="${_templateParams['historySearch_cat']}" />
<!-- 功能导航 -->
<epgdata:bizList var="funcBiz" code="${_context.bizCode}"/>

<!DOCTYPE html>
<html>
<head>
	<title>SMART_TV</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<%@include file="/sites/weixin/js/common.jsp" %>
	<%@include file="/sites/weixin/common/common_js.jsp" %>
	<link rel="stylesheet" type="text/css" href="${_contextPath}/sites/weixin/css/wx.css" />
	<script>
	function init(){
		//alert("${EPG_USER_SESSION.userId}");
		console.log("userId:"+"${EPG_USER_SESSION.userId}");
	}
	</script>
</head>
<body onload="init()">
<div id="app">
	<!-- 上方菜单 -->
	<c:set var="menuIdx" value="3"/>
	<%@include file="topMenu.jsp" %>
	
	<!-- 用户头像 -->
	<c:if test="${EPG_USER_SESSION.isGuest}">
	<epgutils:currUrl var="currentUrl"/>
	<epgutils:wechatUrl var="loginUrl" action="login" from="${currentUrl}"/>
		<div class="row row-detail" style="margin-top:5em;margin-left:1em;" onclick="gotoLink('${loginUrl}')">
				<div class="col-xs-3 row-empty">
					<img  class="content-image" style="border-radius: 50%;max-width: 86%;" src="${_templatePath}/images/person.png"/>
				</div>
				<div class="col-xs-8" style="padding:0px;padding-top: 1em;" >
					<div style="font-size:1.25em;">点击登录</div>
					<div style="color:#aaaaaa;font-size:1.1em;">更多精彩等着你</div>
				</div>
				<div class="col-xs-1" style="margin-top: 2em;padding:0px;color:#d0cdcd">
					<span class="glyphicon glyphicon-menu-right"></span>
				</div>
		</div>
	</c:if>
	
	<c:if test="${!EPG_USER_SESSION.isGuest}">
		<div class="row row-detail" style="margin-top:5em;margin-left:1em;">
				<div class="col-xs-3 row-empty">
					<img class="content-image" style="border-radius: 50%;max-width: 94%;width:76px;height:76px;" src="${EPG_USER_SESSION.wechatUser.avator}" />
				</div>
				<div class="col-xs-8" style="padding:0px;padding-top: 1em;" >
					<div style="font-size:1.25em;">${EPG_USER_SESSION.wechatUser.nickname}</div>
					<div style="color:#aaaaaa;font-size:1.1em;">欢迎你！</div>
				</div>
		</div>
	</c:if>
	
	<div class="index-line" style="margin-top:1em;height: 0.3em;"></div>
	
	<c:forEach items="${funcBiz}" var="item" varStatus="i">
		<c:if test="${i.index != 3}">
		<div class="row row-detail" style="height:3.5em;margin-left:1em;line-height: 3.3em;"
			     onclick="toPersonPage('${item.url}','person_${i.index}')">
			        <div class="col-xs-1 row-empty">
			        	<img class="content-image" style="" src="${_templatePath}/images/person_${i.index}.png"/>
			        </div>
			        <div class="col-xs-10 row-empty">
			            <div class="index-text" style="font-size:1.25em;">${item.title}</div>
			        </div>
			        <div class="col-xs-1 row-empty" style="color:#d0cdcd">
						<span class="glyphicon glyphicon-menu-right"></span>
					</div>
	    </div>
	    </c:if>
	    <c:if test="${i.index == 1 }">
	    	<div class="index-line row-empty" style="height:0.3em;margin-top:0px;"></div>
	    </c:if>
	    <c:if test="${i.index != 1 }">
	    	<div class="index-line row-empty" style="height:0.1em;margin-top:0px;margin-left: 1em;margin-right: 1em;"></div>
	    </c:if>
	</c:forEach>

	<!-- 提示登录蒙版 -->
	<div id="alertDiv" style="display:none;text-align:center;line-height:5em; position:absolute;left:15%;top:40%; width: 70%;height:5em;background-color: black;color:white;border-radius:1em;font-size:1.5em;z-index:99999;opacity:0.6;">您尚未登录！</div>
</div>
<script>
function toPersonPage(url,id){
	stbs = weixinOption.bind;
	if(stbs.length >= 1){
	    gotoLink(url,id);
	}else{
		gotoLink("${funcBiz[1].url}",id);
	}
	//gotoLink(url,id,1);
}
function gotoLink(pageUrl, id) {
	var leavefid = id;
    var updateUrl = "";
    if(leavefid!=""){
        updateUrl = addUrlParameter(pageUrl,'lfid',leavefid);
    }else{
        updateUrl = pageUrl;
    }
    window.location.href = updateUrl;
}
</script>
<%@include file="/sites/weixin/common/bodyEndVm.jsp" %>
</body>
</html>